package erfgame.core.world.terrain;

import java.util.List;

public class TerrainMaterialTypeFactory {
	private static final int MAX_TERRAIN_TYPE = 256;
	
	private TerrainMaterialType[] materialTypes;
	
	public TerrainMaterialTypeFactory( List<TerrainMaterialType> types ) {
		this();
		setMaterialTypes(types);
	}
	
	public TerrainMaterialTypeFactory() {
		this.materialTypes = new TerrainMaterialType[MAX_TERRAIN_TYPE];
	}
	
	public MaterialType getMaterialType( int id ) {
		return this.materialTypes[ id ];
	}
	
	public void setMaterialTypes(List<TerrainMaterialType> types) {
		for( TerrainMaterialType type : types ) {
			materialTypes[type.getId()] = type;
		}
	}
}
